import request from "../utils/request.js";

const api = {
  getMenuList: "/menuList",
  getMenuListByPage: "/menuListByPage",
  createMenuItem: "/createMenu",
  editMenu: "/editMenu",
  deleteMenu(id) {
    return `/deleteMenu/${id}`;
  },
};

export const getMenuList = () => {
  return request({ url: api.getMenuList, method: "get" });
};

export const getMenuListByPage = (params = {}) => {
  return request({ url: api.getMenuListByPage, method: "get", params });
};

export const createMenuItem = (data = {}) => {
  return request({ url: api.createMenuItem, method: "post", data });
};

export const editMenu = (data = {}) => {
  return request({ url: api.editMenu, method: "put", data });
};

export const deleteMenu = (id) => {
  return request({ url: api.deleteMenu(id), method: "delete" });
};
